$(document).ready(function(){

  
  $("#submit_signup").click( 	  
		    function(){
		    	document.getElementById("notification").style.visibility="visible";
		    	var form_data = {
		    			fname: $("#fname").val(),
		    			lname: $("#lname").val(),
		    			uemail: $("#uemail").val(),
		    			username_su: $("#username_su").val(),
		    			password_su: $("#password_su").val(),
		    			password_suc: $("#password_suc").val(),
		    			accessLevel: $("#accessLevel").val(),
		                bmPis2012Tok: $("input[name=bmPis2012Tok]").val()
		            };
		    	
		        $.ajax({
		        	type: "POST",
		            url: baseurl+"user/signup",
		            dataType: "json",
		            data: form_data,
		            success: 
		              function(data){
		            	
		            	 $("#debug").html(data.message).css({'background-color' : data.bg_color}).fadeIn('slow');
		            	
		            	 $('#myModal').reveal({
		                     animation: 'fadeAndPop',                   //fade, fadeAndPop, none
		                     animationspeed: 300,                       //how fast animtions are
		                     closeonbackgroundclick: true,              //if you click background will modal close?
		                     dismissmodalclass: 'close-reveal-modal'    //the class of a button or element that will close an open modal
		                 });
		                 
		                 var modalLocation = $(this).attr('data-reveal-id');
		         		$('#'+modalLocation).reveal($(this).data());     	
		              }
		        });

		      return false;

  });
  

});